//
//  BCNSpcCommon.h
//  Beacon
//
//  Created by arden on 11/19/11.
//  Copyright 2011 Fried Chicken Legs. All rights reserved.
//
//	common defination for spc module

#import <Foundation/Foundation.h>


/// <summary>
/// SPC chart type
/// reference URL http://en.wikipedia.org/wiki/Control_chart
/// 
/// XbarR   AVERAGES AND RANGE CHARTS
/// XbarS   AVERAGES AND STDEV CHARTS
/// XMR     Shewhart individuals control chart
/// C       Count Charts
/// U       Unit Charts
/// P       Proportion Charts 
/// NP      Number of Proportion Charts
/// </summary>
typedef enum { XBarR, XBarS, XMR, C, U, P, NP } BCNSpcChartType;

/// <summary>
/// Spc data type for calculate sigma
/// </summary>
typedef enum  { Mean, Range, Std } BCNSpcDataType;


/// <summary>
/// Western Electric rules
/// </summary>
typedef enum 
{
	WERule1,        // Any single data point falls outside the 3σ limit from the centerline.
	
	WERule2,        // 2 out of 3 consecutive points fall beyond the 2σ limit (in zone A or beyond),
					// on the same side of the centerline.
	
	WERule3,        // 4 out of 5 consecutive points fall beyond the 1σ limit (in zone B or beyond), 
					// on the same side of the centerline.
	
	WERule4,        // 9 consecutive points fall on the same side of the centerline (in zone C or beyond).
	
	Trend,          // 7 or more consecutive points without a change in direction.
	
	Oscillation,    // 14 or more consecutive points alternate in direction.
	
	Stratification, // 15 or more consecutive points fall inside 1σ zone.
	
	Mixture         // 8 or more consecutive points fall outside 1σ zone and on both sides.
} BCNSpcRuleType;

/// <summary>
/// inditify the side 
/// </summary>
typedef enum  { Upper, Lower, Both } BCNSpcControlSide;

/// <summary>
/// way to discribe a rule
/// </summary>
@interface  BCNSpcRuleDefinition: NSObject
{
	BCNSpcRuleType Type;
	BCNSpcControlSide Side;
}

-(void) initWithType: (BCNSpcRuleType) type AndSide :(BCNSpcControlSide) side;

@end



